﻿using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;

namespace RockBus.DataContracts
{
    [MessageContract(WrapperNamespace = StringConstants.RockBusNamespace)]
    public class RemovePublishersRequest
    {
        public RemovePublishersRequest()
        {
            this.PublisherIds = new List<string>();
        }

        public RemovePublishersRequest(string publisherId)
            : this()
        {
            this.PublisherIds.Add(publisherId);
        }

        public RemovePublishersRequest(IEnumerable<string> publisherIds)
            : this()
        {
            foreach (string id in publisherIds)
            {
                this.PublisherIds.Add(id);
            }
        }

        [MessageBodyMember]
        public ICollection<string> PublisherIds { get; private set; }

        public RemovePublishersRequest CreateRemovePublishersRequest(PublisherConfiguration toExclude)
        {
            return new RemovePublishersRequest(this.PublisherIds.Where((pi) => !toExclude.EvaluationElementDictionary.ContainsKey(pi)));
        }
    }

    [MessageContract(WrapperNamespace = StringConstants.RemoveAllPublishersAction)]
    public class RemoveAllPublishersRequest
    {
    }
}